home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
prodpack.zip
/
DB4PPSRC.EXE
/
_PLSWAIT.PRG
< prev
next >
Wrap
Text File
|
1993-05-04
|
3KB
|
81 lines
PROCEDURE _PlsWait
PARAMETERS pc_msg
*----------------------------------------------------------------------------
* NAME
* _PlsWait - Display a "Please wait" box.
*
* SYNOPSIS
* DO _PlsWait WITH <pc_msg>
*
* DESCRIPTION
* _PlsWait will display the <pc_msg> string in a box and display
* a centered "Please wait..." message. This is useful to display
* during operations that may take a long time such as re-indexing.
* The window will always be centered in the screen.
*
* PARAMETERS
* pc_msg - the message to display in the box. If the length is
* greater than 76, the trailing part is chopped off.
*
* EXAMPLE
* DO _PlsWait WITH "Re-indexing files"
* Displays the message in a window as follows at row 9 on the screen:
* +-------------------+
* | |
* | Re-indexing files |
* | |
* | Please wait... |
* | |
* +-------------------+
* Note that the width of the window can increase to accomodate a longer
* message string.
*
* LIMITATIONS
* Truncates the message after 76 characters. Assumes an 80 character
* wide screen. Looks best with SET CURSOR OFF.
*
* Note also that for speed, _PlsWait simply creates and activates
* a window named _PlsWait. It is up to the calling program to
* subsequently DEACTIVATE and RELEASE this window. Also for speed,
* _PlsWait assumes that the window _PlsWait does not already exist.
*
*----------------------------------------------------------------------------
PRIVATE lc_msg, lc_plswait, ln_msglen, ln_width
lc_plswait = [Please wait...]
ln_plslen = LEN( lc_plswait )
lc_msg = LTRIM( RTRIM( pc_msg ) ) && Trimmed message
ln_msglen = LEN( lc_msg ) && Trimmed length of message
ln_width = 0 && Window, then display, width
*-- Determine if we need to make a wider window:
IF ln_msglen <= ln_plslen
ln_width = ln_plslen
ELSE
*-- Make sure the message fits in the window:
IF ln_msglen > 76
lc_msg = LEFT( lc_msg, 76 )
ln_msglen = 76
ENDIF
ln_width = ln_msglen
ENDIF
lc_CoMess = _ColorChk( "M" )
DEFINE WINDOW _PlsWait FROM 9, ((76 - ln_width) + .5) / 2 ;
TO 15, (ln_width + 83) / 2 DOUBLE ;
COLOR &lc_CoMess
ln_width = ( ln_width + 2 ) && Width of window area.
*-- Display the message and prompt to the window and wait for a key press
ACTIVATE WINDOW _PlsWait
@ 1, ( ln_width - ln_msglen ) / 2 SAY lc_msg
@ 3, ( ln_width - ln_plslen ) / 2 SAY lc_plswait
RETURN
*-- EOP: _PlsWait WITH pc_msg